<template>
  <div style="margin-left: 15px; margin-right: 10px;">
    <div style="margin-bottom: 12px;">
      <a-row>
        <a-col span="12"><span style="font-size: 16px;">填报单位：{{ form?.unit }}</span></a-col>
        <a-col span="12"><span style="font-size: 16px;">填报日期：{{ form?.fillDate }}</span></a-col>
      </a-row>
    </div>
    <a-descriptions bordered :column="4">
      <a-descriptions-item label="井名">{{ form?.wellId || "---" }}</a-descriptions-item>
      <a-descriptions-item label="井型">{{ form?.wellType || "---" }}</a-descriptions-item>
      <a-descriptions-item label="井别">{{ form?.wellCategory || "---" }}</a-descriptions-item>
      <a-descriptions-item label="钻井队号">{{ form?.teamNumber || "---" }}</a-descriptions-item>
      <a-descriptions-item label="油气田">{{ form?.gasName || "---" }}</a-descriptions-item>
      <a-descriptions-item label="区域" :span="2">{{ form?.region || "---" }}</a-descriptions-item>
      <a-descriptions-item label="钻头尺寸(mm)">{{ form?.bitSize || "---" }}</a-descriptions-item>
      <a-descriptions-item label="作业井深(m)">{{ form?.operatingWellDepth || "---" }}</a-descriptions-item>
      <a-descriptions-item label="最大井斜(°)">{{ form?.maxDeviation || "---" }}</a-descriptions-item>
      <a-descriptions-item label="钻井液类型">{{ form?.fluidType || "---" }}</a-descriptions-item>
      <a-descriptions-item label="钻井液密度(g/cm^3)">{{ form?.fluidDensity || "---" }}</a-descriptions-item>
      <a-descriptions-item label="钻井液粘度(s)">{{ form?.viscosity || "---" }}</a-descriptions-item>
      <a-descriptions-item label="项目部">{{ form?.projectDepartment || "---" }}</a-descriptions-item>
      <a-descriptions-item label="施工队伍">{{ form?.constructionTeam || "---" }}</a-descriptions-item>
      <a-descriptions-item label="作业类别">{{ form?.jobClass || "---" }}</a-descriptions-item>
      <a-descriptions-item label="施工工艺">{{ form?.craft || "---" }}</a-descriptions-item>
      <!-- <a-descriptions-item label="电缆外径/拉断力">{{ form?.cableDiameterPullForce || "---" }}</a-descriptions-item> -->
      <a-descriptions-item label="弱点设置(lbs)">{{ form?.weaknessSettings || "---" }}</a-descriptions-item>
      <a-descriptions-item label="作业空间">{{ form?.workSpace || "---" }}</a-descriptions-item>
      <a-descriptions-item label="遇卡仪器">{{ form?.stuckInstruments || "---" }}</a-descriptions-item>
      <a-descriptions-item label="遇卡描述">{{ form?.description || "---" }}</a-descriptions-item>
      <a-descriptions-item label="电缆张力">{{ form?.tension || "---" }}</a-descriptions-item>
      <a-descriptions-item label="卡点">{{ form?.points || "---" }}</a-descriptions-item>
      <a-descriptions-item label="遇卡原因">{{ form?.cause || "---" }}</a-descriptions-item>
      <a-descriptions-item label="套管程序" :span="4">
        <a-descriptions-item v-for="(casingItem, index) in form.casingList" :key="index">
          <p>套管名称: {{ casingItem?.name || "---" }}</p>
          <p>外径: {{ casingItem?.outerDiameter || "---" }}</p>
          <p>深度: {{ casingItem?.deep || "---" }}</p>
        </a-descriptions-item>
      </a-descriptions-item>
      <a-descriptions-item label="基础数据" :span="4">
        <a-descriptions bordered>
          <a-descriptions-item label="复杂类型">{{ form?.complexType || "---" }}</a-descriptions-item>
          <!-- <a-descriptions-item label="下井仪器">{{ form?.instrumentName || "---" }}</a-descriptions-item>
                    <a-descriptions-item label="仪器外径">{{ form?.instrumentOutsideDiameter || "---" }}</a-descriptions-item>
                    <a-descriptions-item label="仪器长度">{{ form?.instrumentLength || "---" }}</a-descriptions-item>
                    <a-descriptions-item label="仪器重量">{{ form?.instrumentWeight || "---" }}</a-descriptions-item> -->
          <a-descriptions-item label="仪器原值">{{ form?.instrumentOriginalValue || "---" }}</a-descriptions-item>
          <a-descriptions-item label="鱼头位置(m)">{{ form?.headPosition || "---" }}</a-descriptions-item>
          <a-descriptions-item label="落鱼信息">{{ form?.fishInformation || "---" }}</a-descriptions-item>
          <a-descriptions-item label="放射源信息">
            {{ form?.radioactiveSourceInformation?.toString() || "---" }}
            <!-- {{ form?.radioactiveSourceInformation || "---"}} -->
          </a-descriptions-item>
          <!-- <a-descriptions-item label="仪器示意简图">{{ }}</a-descriptions-item> -->
        </a-descriptions>
      </a-descriptions-item>
      <a-descriptions-item label="电缆信息" :span="4">
        <a-descriptions bordered>
          <a-descriptions-item label="电缆型号">{{ cable?.cableId || "---" }}</a-descriptions-item>
          <a-descriptions-item label="电缆直径(mm)">{{ cable?.diameter || "---" }}</a-descriptions-item>
          <a-descriptions-item label="电缆拉断力(KN)">{{ cable?.breakingForce || "---" }}</a-descriptions-item>
        </a-descriptions>
      </a-descriptions-item>
      <a-descriptions-item label="工程复杂经过" :span="4">{{ form?.complexPassage || "---" }}</a-descriptions-item>
      <a-descriptions-item label="初步原因分析" :span="4">{{ form?.causeAnalysis || "---" }}</a-descriptions-item>
      <a-descriptions-item label="井筒状况" :span="4">{{ form?.wellboreCondition || "---" }}</a-descriptions-item>
      <a-descriptions-item label="下步处置方案" :span="4">{{ form?.nextSteps || "---" }}</a-descriptions-item>
      <a-descriptions-item label="填报人">{{ form?.fillPeople || "---" }}</a-descriptions-item>
      <a-descriptions-item label="联系方式">{{ form?.phoneNumber || "---" }}</a-descriptions-item>
    </a-descriptions>
  </div>
</template>
<script setup>
import { updateOne, createOne, getOne } from "@/api/salvage/accidentAlert";
import FileList from "@/custom/salvage/components/FileList.vue";
import WellCables from '@/api/tool/cable.js'
const props = defineProps({
  reportId: {
    type: String
  }
})
const form = ref({});
const cable = ref({});

// 监听数据变化
watch(() => props.reportId, () => {
  console.log('props.reportId', props.reportId);
  getAccident()
})

// 获取事故报告信息
function getAccident() {
  getOne(props.reportId).then(res => {
    console.log('getAccident', res);
    form.value = res
    if (res.cableId) {
      WellCables.queryOne(res.cableId).then(response => {
        cable.value = response
      })
    }
  })
}
getAccident()
</script>